class CreateAulas < ActiveRecord::Migration
  def self.up
    create_table :aulas do |t|
      t.references :disciplina
      t.string :titulo, :limit => 100, :null => false
      t.datetime :data, :null => false
      t.datetime :hora, :null => false
      t.string :discucao,  :limit => 100, :null => false
      t.string :anotacoes,  :limit => 100, :null => false
      
      t.timestamps
    end
  add_index :aulas, :titulo, :unique => true
  execute("alter table aulas add foreign key (disciplina_id) references disciplinas(id)")
  end

  def self.down
    drop_table :aulas
  end
end